package cn.jiedanba.cacert.model;

import java.io.Serializable;
import java.util.Date;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Id;
import com.mybatisflex.annotation.KeyType;
import com.mybatisflex.annotation.Table;

import cn.jiedanba.cacert.mapper.handler.CryptoPrivateKeyTypeHandler;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * 根证书
 * 
 * @author
 */
@Data
@Table("tb_root_ca")
@Accessors(chain = true)
public class RootCa implements Serializable {

	@Id(keyType = KeyType.Generator, value = "snowflake")
	private String id;

	/**
	 * 父ID，一级根证书为空
	 */
	private String parentId;

	/**
	 * 证书类型 ROOT：根证书 SSLROOT：SSL根证书
	 */
	private String certType;

	/**
	 * 证书名称
	 */
	private String certName;

	/**
	 * 证书序列号
	 */
	private String serialNumber;

	/**
	 * 证书主题
	 */

	private String subjectDn;

	/**
	 * 签名算法
	 */
	private String signAlgorithm;

	/**
	 * 证书生效时间
	 */

	private Date notBefore;

	/**
	 * 证书过期时间
	 */

	private Date notAfter;

	private String keyUsage;

	/**
	 * 创建时间
	 */

	private Date createDate;

	/**
	 * 更新时间
	 */

	private Date updateDate;

	/**
	 * 公钥位数
	 */
	private Integer publicKeySize;

	/**
	 * 私钥
	 */
	@Column(typeHandler = CryptoPrivateKeyTypeHandler.class)
	private String privateKey;

	/**
	 * 签名证书
	 */
	private String signCert;

	/**
	 * 证书状态
	 */
	private String status;

	private String ocsp;

	private String crl;

	private String crt;

	/**
	 * 算法 RSA SM2 ECDSA
	 */
	private String algorithm;

	private static final long serialVersionUID = 1L;

}